<?php
namespace Plugin\Attractions\Inspection\Schema\Inspection_records;

use Plugin\Attractions\Inspection\Model\Inspection_records\InspectionRecords;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 日常巡检记录
 */
#[Schema(title: 'InspectionRecordsSchema')]
class InspectionRecordsSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'plan_id', title: '巡检计划ID', type: 'bigint')]
    public string $plan_id;

    #[Property(property: 'start_time', title: '巡检开始时间', type: 'datetime')]
    public string $start_time;

    #[Property(property: 'end_time', title: '巡检结束时间', type: 'datetime')]
    public string $end_time;

    #[Property(property: 'inspector', title: '巡检人', type: 'array')]
    public array $inspector;

    #[Property(property: 'remark', title: '备注（可选）', type: 'varchar')]
    public string $remark;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;




    public function __construct(InspectionRecords $model)
    {
       $this->id = $model->id;
       $this->plan_id = $model->plan_id;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->inspector = $model->inspector;
       $this->remark = $model->remark;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'plan_id' => $this->plan_id ,'start_time' => $this->start_time ,'end_time' => $this->end_time ,'inspector' => $this->inspector ,'remark' => $this->remark ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}